<template>
  账号：<input type="text" v-model="loginForm.userPhone">
  密码：<input type="text" v-model="loginForm.password">
  <button @click="onSubmit()">提交</button>
  <button @click="getLoginUser()">获取现在用户</button>
</template>

<script setup lang="ts">
import {ref} from "vue";
import type {UserLoginInfo, UserLoginRequest} from "../type/user";
import {getUser, login} from "../service/user.ts";

const loginForm = ref<UserLoginRequest>({
    userPhone:"",
    password:""
})
const onSubmit = async ()=>{
  const res = await login(loginForm.value);
  console.log(res)
}

const getLoginUser = async ()=>{
    const res = await getUser<UserLoginInfo>();
    console.log(res)
    //{code:xx,data:xx}
}
</script>

<style scoped>

</style>